package com.xc.ezplan.core.utils;

import java.io.PrintWriter;
import java.io.StringWriter;

/**
 * @author lixingchen
 * @date 2022/11/19
 * @description 堆栈工具类
 */
public class ThrowableUtil {

    /**
     * 获取堆栈信息
     */
    public static String getStackTrace(Throwable throwable){
        StringWriter sw = new StringWriter();
        try (PrintWriter pw = new PrintWriter(sw)) {
            throwable.printStackTrace(pw);
            return sw.toString();
        }
    }
}
